Setting a new password error

after adding the acces types and the users i want the give them a password so i can log in as those users. after clicking on the copy password to clipboard i can go to the page but when i put in a new password i get the error something went wrong. changing the password for the root user the first time i open up from empty works fine

Can you share your definition of the 'Users' and 'Passwords' collections from your application model? It is important that users have sufficient permissions to be able to update their own password.

If you follow https://alan-platform.com/pages/docs/model/106/application/grammar.html#application-users, leaving out everything related to ‘authorities’, then it should work correctly.


hi thank you the error is indeed in this part of the code that is giving me trouble.
if i run it like this the user is no longer ablte to reset the password from their own own screen.
and the users remain visible in the password part the aplication. outside of admin i want most user unable to see who the other users are accept for 1 group of users who differ by acces type. how would i go about this

This is a minimal example with explanation in the comments about the permissions.

It achieves the following:

  • Only Admin users can create other users.
  • Admin users can see all other users and passwords.
  • Users can not see other users, just their own User + Password entries.
  • Users can reset their own password.

The documentation on https://alan-platform.com/pages/docs/model/106/application/grammar.html#permissions has a more detailed explanation about the correct usage of can-read, can-update etc.

users
	dynamic: .'Users'
		passwords: .'Passwords'
			password-value: .'Data'.'Password'
			password-status: .'Data'.'Active' (
				| active => 'Yes' ( )
				| reset  => 'No' ( )
			)
			password-initializer: (
				'Data' = ( )
			)

interfaces

root {
	// only authenticated users can read application data:
	can-read: user
	// only an Admin user can modify data in this app, except when
	// permission overrides are defined using 'can-update':
	can-update: user .'Admin'?'Yes'

	'Access Types': collection ['Type'] @small {
		'Type': text
	}
	'Users': collection ['User'] {
		// users can only see their own entry in 'Users'
		// and an Admin user can see all users:
		can-read: user is ( ) || user .'Admin'?'Yes'

		'User': text
		'Admin': stategroup (
			'Yes' { }
			'No' {
				'Access Type': text -> ^ ^ .'Access Types'[]
			}
		)
	}
	'Passwords': collection ['User'] {
		// users can only see their own entry in 'Passwords'
		// and an Admin user can see all users:
		can-read: user is ( >'User' ) || user .'Admin'?'Yes'

		'User': text -> ^ .'Users'[]
		'Data': group {
			// users can only change their own entry in 'Passwords'
			// and an Admin user can change the passwords of all users:
			can-update: user .'Admin'?'Yes' || user is ( ^ >'User' )

			'Password': text
			'Active': stategroup (
				'No' { }
				'Yes' { }
			)
		}
	}
}

numerical-types

If you have this working correctly, I believe you should be able to extend this example to give users with a specific ‘Access Type’ more permissions than other users.