-
Notifications
You must be signed in to change notification settings - Fork 30
/
resetPassword.html.twig
91 lines (85 loc) · 3.77 KB
/
resetPassword.html.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
{% extends "@UVDeskSupportCenter/Templates/layout.html.twig" %}
{% block title %}{% trans %}Account Validation{% endtrans %}{% endblock %}
{% block ogtitle %}{% trans %}Account Validation{% endtrans %}{% endblock %}
{% block twtitle %}{% trans %}Account Validation{% endtrans %}{% endblock %}
{% block metaDescription %}{% trans %}account.validation.metaDescription{% endtrans %}{% endblock %}
{% block metaKeywords %}{% trans %}account.validation.metaKeywords{% endtrans %}{% endblock %}
{% block body %}
<div class="uv-paper-article uv-paper-form">
<div class="uv-paper-section">
<form action="" method="post" id="resetPasswordForm">
<section>
<h1>{{ 'Reset Password'|trans }}</h1>
<div class="uv-element-block">
<p>{{ 'Enter your new password below to update your login credentials'|trans }}</p>
</div>
<div class="uv-form">
<div class="uv-element-block">
<label class="uv-field-label">{{ 'Password'|trans }}</label>
<div class="uv-field-block uv-relative">
<input class="uv-field" type="password" name="password">
</div>
</div>
<div class="uv-element-block">
<label class="uv-field-label">{{ 'Confirm Password'|trans }}</label>
<div class="uv-field-block uv-relative">
<input class="uv-field" type="password" name="confirmPassword">
</div>
</div>
<button class="uv-btn">{{ 'Save Password'|trans }}</button>
</div>
</section>
</form>
</div>
</div>
{% endblock %}
{% block footer %}
{{ parent() }}
<script type="text/javascript">
$(function () {
var ResetPasswordModel = Backbone.Model.extend({
validation: {
'password': [{
required: true,
msg: '{{ "This field is mandatory"|trans }}'
},{
pattern: /^(?=(.*[a-zA-Z].*){2,})(?=.*\d.*)(?=.*\W.*)[a-zA-Z0-9\S]{8,}$/,
msg: '{{ "Password must contain minimum 8 character length, at least two letters (not case sensitive), one number, one special character(space is not allowed)."|trans }}'
}],
'confirmPassword': {
equalTo: 'password',
msg: '{{ "The passwords does not match"|trans }}'
},
}
});
var ResetPasswordForm = Backbone.View.extend({
events: {
'blur input': 'formChanegd',
'click .uv-btn': 'submit'
},
initialize: function () {
Backbone.Validation.bind(this);
{% if error.messageKey is defined %}
app.appView.renderResponseAlert({'alertClass': 'danger', 'alertMessage': "{{ error.messageKey }}"})
{% endif %}
},
formChanegd: function(e) {
this.model.set(Backbone.$(e.currentTarget).attr('name'), Backbone.$(e.currentTarget).val())
this.model.isValid([Backbone.$(e.currentTarget).attr('name')])
},
submit: function (e) {
e.preventDefault()
var data = this.$el.serializeObject();
this.model.set(data);
if(this.model.isValid(true)){
this.$el.submit();
}
}
});
var view = new ResetPasswordForm({
el: '#resetPasswordForm',
model: new ResetPasswordModel()
});
});
</script>
{% endblock %}