Improve message visibility on signup
authorChocobozzz <me@florianbigard.com>
Fri, 16 Nov 2018 16:02:21 +0000 (17:02 +0100)
committerChocobozzz <me@florianbigard.com>
Fri, 16 Nov 2018 16:02:21 +0000 (17:02 +0100)
client/src/app/signup/signup.component.html
client/src/app/signup/signup.component.ts
client/src/app/videos/+video-edit/shared/video-caption-add-modal.component.ts

index 531a978146d862f84aadbabbe576d191098640bd..0207a166eadb07bf1fb4aedd30d559b4029ac75b 100644 (file)
@@ -4,6 +4,7 @@
     Create an account
   </div>
 
+  <div *ngIf="info" class="alert alert-info">{{ info }}</div>
   <div *ngIf="error" class="alert alert-danger">{{ error }}</div>
 
   <div class="d-flex justify-content-left flex-wrap">
@@ -59,7 +60,7 @@
         </div>
       </div>
 
-      <input type="submit" i18n-value value="Signup" [disabled]="!form.valid">
+      <input type="submit" i18n-value value="Signup" [disabled]="!form.valid || signupDone">
     </form>
 
     <div>
index cf2657b85d382ab61e1b24f798b6e12aac159238..607d648937b164ea1b254c8e7cfac2b63e29455e 100644 (file)
@@ -12,7 +12,9 @@ import { FormValidatorService } from '@app/shared/forms/form-validators/form-val
   styleUrls: [ './signup.component.scss' ]
 })
 export class SignupComponent extends FormReactive implements OnInit {
+  info: string = null
   error: string = null
+  signupDone = false
 
   constructor (
     protected formValidatorService: FormValidatorService,
@@ -50,17 +52,17 @@ export class SignupComponent extends FormReactive implements OnInit {
 
     this.userService.signup(userCreate).subscribe(
       () => {
+        this.signupDone = true
+
         if (this.requiresEmailVerification) {
-          this.notificationsService.alert(
-            this.i18n('Welcome'),
-            this.i18n('Please check your email to verify your account and complete signup.')
-          )
-        } else {
-          this.notificationsService.success(
-            this.i18n('Success'),
-            this.i18n('Registration for {{username}} complete.', { username: userCreate.username })
-          )
+          this.info = this.i18n('Welcome! Now please check your emails to verify your account and complete signup.')
+          return
         }
+
+        this.notificationsService.success(
+          this.i18n('Success'),
+          this.i18n('Registration for {{username}} complete.', { username: userCreate.username })
+        )
         this.redirectService.redirectToHomepage()
       },
 
index 796fbe531ae9496fda8637cd2d9872d6cafa4c6c..eaf8197264366e49bfb54e960f33eb0f44113467 100644 (file)
@@ -60,6 +60,7 @@ export class VideoCaptionAddModalComponent extends FormReactive implements OnIni
   hide () {
     this.closingModal = true
     this.openedModal.close()
+    this.form.reset()
   }
 
   isReplacingExistingCaption () {