Categories
Mastering Development

I want to implement remote validation for registration but not login in ASP.NET, as it won’t let any user login

I know that this would be easier if I had different view models for login and register however unfortunately they must be in the same view model. This is the relevant methods in usercontroller public async Task<IActionResult> Login([Bind("Email,Password")]UserViewModel m) { // call service to Authenticate User var user = svc.Authenticate(m.Email, m.Password); if (user == null) […]

Categories
Mastering Development

How can I provide conditions in SQL query?

I’m trying to update the database table. How can I prevent the password ("MemberPassword", $ pass) coming from the form from being updated with sql codes by providing a condition if it is empty? Is it possible? //database connection $SQL = "mysql:host=" . $this->MYSQL_HOST . ";dbname=" . $this->MYSQL_DB; try { $this->pdo = new \PDO($SQL, $this->MYSQL_USER, […]

Categories
Mastering Development

Can I build a serializer that validates username and email existence on is_valid call?

guys! I have this serializer class for the user model class UserSerializer(serializers.ModelSerializer): username = serializers.RegexField("^(?=.{6,20}$)(?![_.])(?!.*[_.]{2})[a-zA-Z0-9._]+(?<![_.])$") full_name = serializers.RegexField("^([a-zA-Z]{2,}\s[a-zA-Z]{1,}’?-?[a-zA-Z]{2,}\s?([a-zA-Z]{1,})?)") email = serializers.EmailField() phone = serializers.RegexField("^(\+\d{1,2}\s?)?1?\-?\.?\s?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$") class Meta: model = User fields = [‘username’, ‘full_name’, ’email’, ‘password’, ‘phone’] This is my serializer class for the moment. I want to validate that the username and email does not […]

Categories
Mastering Development

How to move the data that I have called from the Firebase real-time database, in a listview to another activity in android studio?

So, I have a simple listview application. When I click an item, it will send the data to the next activity using Bundle. In the first time, I use this JSON structure "teacher": [ { "name": "Carl", "age": "40" }, { "name": "Johnson", "age": "44" } ], And this is my Java code: Query query […]

Categories
Mastering Development

Array returns as null in JS but “non-null” in GS

I’m attempting to use Apps Script and JS on a web app to retreive information stored in a google sheet, then output it to the webapp. However, I keep getting the error "cannot read property of null". Problem is, when i run the apps script side of the code (as follows), my array is fine […]

Categories
Mastering Development

CORS error, unable to send request to API

Below is my code and I am unable to figure out why I get >net::ERR_CONNECTION_REFUSED TypeError: Failed to fetch const signup=(user)=>{ // console.log(name,email,password); fetch(`${API}/signup`,{ //we can write whatever we are gonna send to backend here method:"POST", mode:’cors’, headers:{ "Content-Type": "application/json", "Access-Control-Allow-Origin": "*", "Access-Control-Request-Method": "*", Accept: "application/json", }, body:JSON.stringify(user) }) .then(response=>{ return response.json() }) .catch(err=>{ console.log(err) […]

Categories
Mastering Development

Error: Unknown authentication strategy “local” while trying to signin

I have been building this project from a tutorial. The signup functionality works fine but the login feature doesn’t work. Whenever I try logging in a registered user using postman the error I get is Error: Unknown authentication strategy "local" In the other posts on stack overflow, I didn’t find a solution to this error. […]

Categories
Mastering Development

Why it’s the else statement executed and if it’s ignored?

I’m having a problem with a Python script, the if branch it’s not executed, no matter what parameters I give to the script. Is it something wrong with my code? I’m executing an HTML form and the result was OK until I’ve added some content to the else statement..I’ve tried everything but it still doesn’t […]

Categories
Mastering Development

Access: Making automatic email reminder using vba

This is my first time to use vba codes in microsoft access, so every code I made is all copied from various sources. What I am trying to do is to make email using outlook to remind someone to update their CV information per 6 months (180 days). I have 1 query and 1 table. […]

Categories
Mastering Development

How to resolve 2d array Promises?

I am trying to resolve an 2d dimension of array of promises but i am unable to resolve it and it shows in Pending states after i used Promise.All can anyone suggest me how to solve this problem here is the getAuth function i am using to get the users info const getAuth = async […]