Meet me in Karlsruhe Updated Open Source Projects

YLOD 1.2 adds support for passwords

Published on Sunday, April 21, 2013 10:24:49 AM UTC in Programming & Tools

After a short period of testing and use in a project, I released version 1.2 of YLOD (on NuGet) today. It adds support for passwords, a feature requested by Brecht over on CodePlex. I was a bit amazed that I didn't ran into this earlier, as having passwords in your app's options seems like an obvious use case. It once again shows the value of feedback from others – thanks for that.

How it works

Passwords integrate in the same way as all other available options by using attributes for configuration. There are two typcial scenarios that are supported:

 1. You want the user to enter credentials for some own or external service. This would be achieved by displaying a *single* password box.
2. You want to enable your users to change some existing credentials, for example for your own service and/or app. This typically requires a second password box to confirm a password change and avoid typos.

The following snippet shows a fully configured password property on your options data container type with the second scenario used. You don't need to configure the confirmation related properties if you're only interested in the first scenario, of course.

[OptionPassword(Description = "This is a password with confirmation, e.g. to change an existing password.",
    GroupName = "passwords",
    ShowConfirmation = true,
    ConfirmationDescription = "Confirm the password:",
    PasswordsDoNotMatchErrorMessage = "Password and password confirmation do not match.",
    MinLength = 3,
    ValidationErrorMessage = "A password must be at least 3 characters long.")]
public string MyPassword

As you can see, the "OptionPassword" attribute inherits some base properties, in particular of the string option attribute, to let you add simple validation checks (through the "MinLength" or "RegularExpression" properties) without requiring custom validators.

Of course the new option supports all the features of other options, including localization and support for both Windows Phone 7 and 8 (more here:

How it looks like

The above example results in an options page like this:


If you want to play around with this or any other features of YLOD, I recommend taking look at the source code, which contains sample applications for both Windows Phone 7 and 8 that make it easier to get started with the project.

I hope you enjoy this new feature and find some use for it. Have fun!

Tags: Windows Phone · Windows Phone 7 · Windows Phone 8 · YLOD