How can I redirect a user’s home (root) path based on their role using Devise?

Your routes.rb file won’t have any idea what role the user has, so you won’t be able to use it to assign specific root routes. What you can do is set up a controller (for example, passthrough_controller.rb) which in turn can read the role and redirect. Something like this: # passthrough_controller.rb class PassthroughController < ApplicationController … Read more

Unable to tunnel through proxy. Proxy returns “HTTP/1.1 407” via https

Change in Java 8 Update 111: Now, proxies requiring Basic authentication when setting up a tunnel for HTTPS will no longer succeed by default. If required, this authentication scheme can be reactivated by removing Basic from the jdk.http.auth.tunneling.disabledSchemes networking property, or by setting a system property of the same name to “” ( empty ) … Read more

How to check device compatibility for finger print authentication in android

You have to use method isHardwareDetected on FingerprintManager class. Determine if fingerprint hardware is present and functional. Returns true if hardware is present and functional, false otherwise. // Check if we’re running on Android 6.0 (M) or higher if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { //Fingerprint API only available on from Android 6.0 (M) FingerprintManager fingerprintManager = … Read more

Uniquely identifying an iOS user

The correct solution is to use the iCloud Key-Value Store, where you can store a unique user ID without requiring any kind of authentication or user information such as an email address. The end result is a random UUID (nothing that actually IDENTIFIES the user), that is different for each user, but will persist across … Read more

Axios interceptors and asynchronous login

Just use another promise 😀 axios.interceptors.response.use(undefined, function (err) { return new Promise(function (resolve, reject) { if (err.status === 401 && err.config && !err.config.__isRetryRequest) { serviceRefreshLogin( getRefreshToken(), success => { setTokens(success.access_token, success.refresh_token) err.config.__isRetryRequest = true err.config.headers.Authorization = ‘Bearer ‘ + getAccessToken(); axios(err.config).then(resolve, reject); }, error => { console.log(‘Refresh login error: ‘, error); reject(error); } ); } … Read more

Built-in helper to parse User.Identity.Name into Domain\Username

This is better (easier to use, no opportunity of NullReferenceExcpetion and conforms MS coding guidelines about treating empty and null string equally): public static class Extensions { public static string GetDomain(this IIdentity identity) { string s = identity.Name; int stop = s.IndexOf(“\\”); return (stop > -1) ? s.Substring(0, stop) : string.Empty; } public static string … Read more