File tree Expand file tree Collapse file tree
src/components/NcPasswordField Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,7 +19,9 @@ General purpose password field component.
1919 <NcPasswordField id="textField"
2020 v-model="text2"
2121 :label-outside="true"
22- placeholder="Min. 12 characters" />
22+ placeholder="Min. 12 characters"
23+ :success="true"
24+ helper-text="Password is secure" />
2325 </div>
2426 <div class="external-label">
2527 <label for="textField2">New password</label>
@@ -32,10 +34,9 @@ General purpose password field component.
3234 </div>
3335
3436 <NcPasswordField v-model="text4"
35- label="Good new password"
36- :success="true"
37- placeholder="Min. 12 characters"
38- helper-text="Password is secure" />
37+ label="Validate new password"
38+ check-password-strength
39+ placeholder="Min. 12 characters" />
3940
4041 <NcPasswordField v-model="text5"
4142 :disabled="true"
@@ -51,7 +52,7 @@ export default {
5152 data() {
5253 return {
5354 text1: '',
54- text2: '',
55+ text2: 'FWZxt29XEoTQfnBEa ',
5556 text3: 'hunter',
5657 text4: '',
5758 text5: '',
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ const USER_GROUPS = [
3030 * @param {object } error Axios error
3131 */
3232function mockRequests ( error ) {
33- const { request } = error
33+ const { request, config } = error
3434 let data = null
3535
3636 // Mock requesting groups
@@ -39,6 +39,22 @@ function mockRequests(error) {
3939 data = { groups : USER_GROUPS . filter ( ( e ) => ! requestGroups [ 1 ] || e . displayname . startsWith ( requestGroups [ 1 ] ) || e . id . startsWith ( requestGroups [ 1 ] ) ) }
4040 }
4141
42+ const requestPasswordPolicy = request . responseURL . match ( / a p p s \/ p a s s w o r d _ p o l i c y \/ a p i \/ v 1 \/ v a l i d a t e / )
43+ if ( requestPasswordPolicy ) {
44+ const payload = typeof config . data === 'string' ? JSON . parse ( config . data ) : config . data
45+
46+ if ( payload . password . length < 12 ) {
47+ data = {
48+ passed : false ,
49+ reason : 'Password needs to be at least 12 characters long' ,
50+ }
51+ } else {
52+ data = {
53+ passed : true ,
54+ }
55+ }
56+ }
57+
4258 if ( data ) {
4359 return Promise . resolve ( { data : { ocs : { data } } } )
4460 }
You can’t perform that action at this time.
0 commit comments