Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 www 1
<template>
2
  <div id="form-forgot-password-container">
3
    <h3>{{title}}</h3>
4
    <form @submit.prevent="submit" name="forgot-password" id="forgot-password" action="" method="post">
5
      <div class="row">
6
			  <div class="col-lg-12 no-pdd">
7
				  <div class="sn-field" :class="{ 'sn-field-has-error': $v.form.email.$error }">
8
					  <input type="text" name="forgot_password_email" id="forgot_password_email" v-bind:placeholder="placeHolderEmail"  maxlength="64" v-model="form.email">
9
						<i class="la la-envelope"></i>
10
					</div><!--sn-field end-->
11
				</div>
12
        <div  v-if="$v.form.email.$error" class="sn-field-invalid-feedback">
13
          {{showErrorEmail}}
14
        </div>
15
        <div class="col-lg-12 no-pdd">
16
          <button type="submit" value="submit">{{textButtonSubmit}}</button>
17
        </div>
18
		  </div>
19
    </form>
20
  </div>
21
</template>
22
 
23
<script>
24
module.exports = {
25
    props: [
26
        'action',
27
        'title',
28
        'textButtonSubmit',
29
        'placeHolderEmail',
30
        'errorRequired',
31
        'errorMaxlength',
32
        'errorEmail',
33
    ],
34
    data: function() {
35
        return {
36
            form: {
37
              email: "",
38
            }
39
        }
40
    },
41
    computed: {
42
      showErrorEmail: function () {
43
          if(!this.$v.form.email.required) {
44
            return this.errorRequired;
45
          }
46
          if(!this.$v.form.email.max) {
47
            return this.errorMaxlength.replace('{0}', 64);
48
          }
49
          if(!this.$v.form.email.email) {
50
            return this.errorEmail;
51
          }
52
          return '';''
53
      }
54
    },
55
    validations: {
56
      form: {
57
        email: {
58
          required,
59
          email,
60
          max: maxLength(64)
61
        },
62
      }
63
    },
64
    methods: {
65
      submit(event) {
66
        this.$v.form.$touch();
67
        if(this.$v.form.$error) {
68
            return false;
69
        }
70
 
71
 
72
 
73
        params = {
74
          'email': this.form.email,
75
        }
76
        this.$Progress.start();
77
        this.$http.post(this.action, params).then(response => {
78
 
79
            this.email = '';
80
            event.target.reset();
81
 
82
            this.$Progress.finish()
83
            if(response.status == 200) {
84
              var data =  response.body;
85
              if(data.success) {
86
                $("#tabs").tabs("option", "active", 0);
87
 
88
                this.$toastr.success(data.message);
89
              } else {
90
                this.$toastr.error(data.message);
91
              }
92
            } else {
93
              this.$toastr.error(response.statusText);
94
            }
95
        }, response => {
96
          this.$Progress.fail()
97
          // error callback
98
        });
99
      }
100
    }
101
}
102
</script>
103
 
104
<style>
105
</style>